package com.hyz.result;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel("分页查询返回的结果实体类")
public class AgencyPage<T> implements Serializable {
    @ApiModelProperty("操作成功与否标识   0：失败 1：成功")
private Integer code;

    @ApiModelProperty("返回一些提示信息")
    private String msg;

    @ApiModelProperty("返回所需的分页数据")
    private IPage<T> page;

    public static AgencyPage error(String msg){
        AgencyPage agencyPage = new AgencyPage();
        agencyPage.code=0;
        agencyPage.msg=msg;
        return agencyPage;
    }
    public static <T>AgencyPage success(String msg,IPage<T> page){
        AgencyPage agencyPage = new AgencyPage();
        agencyPage.code=1;
        agencyPage.msg="操作成功";
        agencyPage.page=page;
        return agencyPage;
    }

}
